package com.huawei.appmarket.service.push;

import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import com.huawei.appgallery.foundation.ui.framework.activity.BaseActivity;
import com.huawei.hms.framework.network.util.HttpUtils;
import com.huawei.hms.support.api.entity.hwid.HwIDConstant.ACTION;
import o.BaseAlertDialog;
import o.BaseAlertDialog.a;
import o.cks;
import o.cud;
import o.Logger;
import o.dof;
import o.ewm.n;

public class PushMessageActivity extends BaseActivity<PushMessageActivityProtocol> {
    private String ˊॱ;
    private BaseAlertDialog ॱˊ;

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        PushMessageActivityProtocol pushMessageActivityProtocol = (PushMessageActivityProtocol) ʾ();
        if (pushMessageActivityProtocol == null || pushMessageActivityProtocol.ˋ() == null) {
            finish();
            return;
        }
        requestWindowFeature(1);
        this.ˊॱ = pushMessageActivityProtocol.ˋ().ˎ();
        String ˊ = pushMessageActivityProtocol.ˋ().ˊ();
        CharSequence ˋ = pushMessageActivityProtocol.ˋ().ˋ();
        if (ˋ != null && ˋ.length() < 60) {
            ˋ = ˋ + "\n\n";
        }
        this.ॱˊ = BaseAlertDialog.ˋ(this, ˊ, ˋ);
        final String ˏ = pushMessageActivityProtocol.ˋ().ˏ();
        if (dof.ˋ(ˏ)) {
            this.ॱˊ.ˏ(a.ˋ, 8);
        }
        this.ॱˊ.ॱ();
        this.ॱˊ.ॱ(a.ˎ, getString(n.ˋʾ));
        if (!dof.ˋ(ˏ)) {
            this.ॱˊ.ॱ(a.ˋ, getString(n.ﾞᐝ));
        }
        this.ॱˊ.ˎ(new OnDismissListener(this) {
            final /* synthetic */ PushMessageActivity ˏ;

            {
                this.ˏ = r1;
            }

            public void onDismiss(DialogInterface dialogInterface) {
                this.ˏ.finish();
            }
        });
        this.ॱˊ.ˎ(new cks(this) {
            final /* synthetic */ PushMessageActivity ॱ;

            public void enableNetworking() {
                try {
                    Intent intent = new Intent(ACTION.HWID_SCHEME_URL, this.ॱ.ˏ(ˏ));
                    intent.addCategory("android.intent.category.BROWSABLE");
                    intent.setComponent(null);
                    intent.setSelector(null);
                    this.ॱ.startActivityIfNeeded(intent, -1);
                } catch (Exception e) {
                    Logger.ˋ("PushMessageActivity", "performConfirm error");
                }
                this.ॱ.finish();
            }

            public void upgrade() {
                this.ॱ.finish();
            }

            public void ˋ() {
            }
        });
    }

    public void onDestroy() {
        super.onDestroy();
        if (this.ॱˊ != null) {
            this.ॱˊ.ˏ();
            this.ॱˊ = null;
        }
    }

    private Uri ˏ(String str) {
        if (!(str.startsWith(HttpUtils.HTTP_PREFIX) || str.startsWith("https://"))) {
            str = HttpUtils.HTTP_PREFIX + str;
        }
        return Uri.parse(cud.ˎ(str) + "source=" + this.ˊॱ);
    }
}
